visible: true,
max_width_chars: 50,
hexpand: true,
- vexpand: (appInfo == null),
+ vexpand: appInfo == null,
halign: Gtk.Align.CENTER,
valign: Gtk.Align.START,
});
return;
this._extension = ExtensionUtils.deserializeExtension(newState);
- let state = (this._extension.state == ExtensionState.ENABLED);
+ let state = this._extension.state == ExtensionState.ENABLED;
this._switch.block_signal_handler(this._notifyActiveId);
this._switch.state = state;
g_interface_info: FprintManagerInfo,
g_name: 'net.reactivated.Fprint',
g_object_path: '/net/reactivated/Fprint/Manager',
- g_flags: (Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) });
+ g_flags: Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES });
try {
self.init(null);
g_interface_info: OVirtCredentialsInfo,
g_name: 'org.ovirt.vdsm.Credentials',
g_object_path: '/org/ovirt/vdsm/Credentials',
- g_flags: (Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) });
+ g_flags: Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES });
self.init(null);
return self;
}
_onForwardKeyEvent(_context, keyval, keycode, state) {
let press = (state & IBus.ModifierType.RELEASE_MASK) == 0;
- state &= ~(IBus.ModifierType.RELEASE_MASK);
+ state &= ~IBus.ModifierType.RELEASE_MASK;
let curEvent = Clutter.get_current_event();
let time;
for (let app of apps) {
let appInfo = {};
- let isAppActive = (focusedApp == app);
+ let isAppActive = focusedApp == app;
if (!this._isStandaloneApp(app))
continue;
return false;
let type = window.get_window_type();
- return (type == Meta.WindowType.NORMAL ||
+ return type == Meta.WindowType.NORMAL ||
type == Meta.WindowType.DIALOG ||
type == Meta.WindowType.MODAL_DIALOG ||
- type == Meta.WindowType.UTILITY);
+ type == Meta.WindowType.UTILITY;
}
GetRunningApplicationsAsync(params, invocation) {
'app-id': GLib.Variant.new('s', app.get_id()),
'client-type': GLib.Variant.new('u', window.get_client_type()),
'is-hidden': GLib.Variant.new('b', window.is_hidden()),
- 'has-focus': GLib.Variant.new('b', (window == focusWindow)),
+ 'has-focus': GLib.Variant.new('b', window == focusWindow),
'width': GLib.Variant.new('u', frameRect.width),
'height': GLib.Variant.new('u', frameRect.height),
};
// findMatchingBrace("[(])", 3) returns 1.
function findMatchingBrace(expr, offset) {
let closeBrace = expr.charAt(offset);
- let openBrace = ({ ')': '(', ']': '[' })[closeBrace];
+ let openBrace = { ')': '(', ']': '[' }[closeBrace];
return findTheBrace(expr, offset - 1, openBrace, closeBrace);
}
// We are only interested in the part in the parentheses. (And
// we can't pattern match the text, since it gets localized.)
let message = err.message.replace(/.*\((.+)\)/, '$1');
- throw new (err.constructor)({ code: err.code, message });
+ throw new err.constructor({ code: err.code, message });
} else {
throw err;
}
max = mid;
}
- return (min == max || cmp(array[min], val) < 0) ? max : min;
+ return min == max || cmp(array[min], val) < 0 ? max : min;
}
// insertSorted:
}
_onInstalledChanged() {
- let hadApp = (this._weatherApp != null);
+ let hadApp = this._weatherApp != null;
this._weatherApp = this._appSystem.lookup_app(WEATHER_APP_ID);
- let haveApp = (this._weatherApp != null);
+ let haveApp = this._weatherApp != null;
if (hadApp !== haveApp)
this.emit('changed');
this._weatherInfo.abort();
this._weatherInfo.set_location(location);
- this._locationValid = (location != null);
+ this._locationValid = location != null;
this._weatherInfo.set_enabled_providers(location ? this._providers : 0);
if (oldFrameActor)
oldFrameActor.hide();
- this._frame = (frame % this._animations.get_n_children());
+ this._frame = frame % this._animations.get_n_children();
let newFrameActor = this._animations.get_child_at_index(this._frame);
if (newFrameActor)
let newApps = [];
this._appInfoList = Shell.AppSystem.get_default().get_installed().filter(appInfo => {
try {
- (appInfo.get_id()); // catch invalid file encodings
+ appInfo.get_id(); // catch invalid file encodings
} catch (e) {
return false;
}
let clickAction = new Clutter.ClickAction();
clickAction.connect('long-press', (action, theActor, state) => {
if (state == Clutter.LongPressState.QUERY) {
- return ((action.get_button() == 0 ||
+ return (action.get_button() == 0 ||
action.get_button() == 1) &&
- !actor._backgroundMenu.isOpen);
+ !actor._backgroundMenu.isOpen;
}
if (state == Clutter.LongPressState.ACTIVATE) {
let [x, y] = action.get_coords();
open(animate, onComplete) {
let themeNode = this.get_theme_node();
let rise = themeNode.get_length('-arrow-rise');
- let animationTime = (animate & PopupAnimation.FULL) ? POPUP_ANIMATION_TIME : 0;
+ let animationTime = animate & PopupAnimation.FULL ? POPUP_ANIMATION_TIME : 0;
if (animate & PopupAnimation.FADE)
this.opacity = 0;
let translationY = 0;
let themeNode = this.get_theme_node();
let rise = themeNode.get_length('-arrow-rise');
- let fade = (animate & PopupAnimation.FADE);
- let animationTime = (animate & PopupAnimation.FULL) ? POPUP_ANIMATION_TIME : 0;
+ let fade = animate & PopupAnimation.FADE;
+ let animationTime = animate & PopupAnimation.FULL ? POPUP_ANIMATION_TIME : 0;
if (animate & PopupAnimation.SLIDE) {
switch (this._arrowSide) {
let borderWidth = themeNode.get_length('-arrow-border-width');
let arrowBase = themeNode.get_length('-arrow-base');
let borderRadius = themeNode.get_length('-arrow-border-radius');
- let margin = (4 * borderRadius + borderWidth + arrowBase);
+ let margin = 4 * borderRadius + borderWidth + arrowBase;
let gap = themeNode.get_length('-boxpointer-gap');
let padding = themeNode.get_length('-arrow-rise');
arrowOrigin = sourceCenterX - resX;
if (arrowOrigin <= (x1 + (borderRadius + halfBase))) {
if (arrowOrigin > x1)
- resX += (arrowOrigin - x1);
+ resX += arrowOrigin - x1;
arrowOrigin = x1;
} else if (arrowOrigin >= (x2 - (borderRadius + halfBase))) {
if (arrowOrigin < x2)
- resX -= (x2 - arrowOrigin);
+ resX -= x2 - arrowOrigin;
arrowOrigin = x2;
}
break;
arrowOrigin = sourceCenterY - resY;
if (arrowOrigin <= (y1 + (borderRadius + halfBase))) {
if (arrowOrigin > y1)
- resY += (arrowOrigin - y1);
+ resY += arrowOrigin - y1;
arrowOrigin = y1;
} else if (arrowOrigin >= (y2 - (borderRadius + halfBase))) {
if (arrowOrigin < y2)
- resX -= (y2 - arrowOrigin);
+ resX -= y2 - arrowOrigin;
arrowOrigin = y2;
}
break;
var NC_ = (context, str) => `${context}\u0004${str}`;
function sameYear(dateA, dateB) {
- return (dateA.getYear() == dateB.getYear());
+ return dateA.getYear() == dateB.getYear();
}
function sameMonth(dateA, dateB) {
vfunc_style_changed() {
let iconVisible = this.get_parent().has_style_pseudo_class('first-child');
- this._icon.opacity = (iconVisible ? 255 : 0);
+ this._icon.opacity = iconVisible ? 255 : 0;
super.vfunc_style_changed();
}
_formatEventTime() {
let periodBegin = _getBeginningOfDay(this._date);
let periodEnd = _getEndOfDay(this._date);
- let allDay = (this._event.allDay || (this._event.date <= periodBegin &&
- this._event.end >= periodEnd));
+ let allDay = this._event.allDay || (this._event.date <= periodBegin &&
+ this._event.end >= periodEnd);
let title;
if (allDay) {
/* Translators: Shown in calendar event list for all day events
_appInstalledChanged() {
this._calendarApp = undefined;
- this._title.reactive = (this._getCalendarApp() != null);
+ this._title.reactive = this._getCalendarApp() != null;
}
_getCalendarApp() {
delete volume._allowAutorunExpireId;
}
this._volumeQueue =
- this._volumeQueue.filter(element => (element != volume));
+ this._volumeQueue.filter(element => element != volume);
}
_reaskPassword(volume) {
let path = root.get_path();
// skip any mounts in hidden directory hierarchies
- return (path.includes('/.'));
+ return path.includes('/.');
}
function isMountNonLocal(mount) {
if (volume == null)
return true;
- return (volume.get_identifier("class") == "network");
+ return volume.get_identifier("class") == "network";
}
function startAppForMount(app, mount) {
_emitCallback(mount, contentTypes = []) {
// we're not interested in win32 software content types here
contentTypes = contentTypes.filter(
- type => (type != 'x-content/win32-software')
+ type => type != 'x-content/win32-software'
);
let apps = [];
}
_getSourceForMount(mount) {
- let filtered = this._sources.filter(source => (source.mount == mount));
+ let filtered = this._sources.filter(source => source.mount == mount);
// we always make sure not to add two sources for the same
// mount in addMount(), so it's safe to assume filtered.length
}
if (this.prompt.confirm_visible) {
- var label = new St.Label(({ style_class: 'prompt-dialog-password-label',
- x_align: Clutter.ActorAlign.START,
- y_align: Clutter.ActorAlign.CENTER }));
+ var label = new St.Label({ style_class: 'prompt-dialog-password-label',
+ x_align: Clutter.ActorAlign.START,
+ y_align: Clutter.ActorAlign.CENTER });
label.set_text(_("Type again:"));
this._confirmEntry = new St.Entry({ style_class: 'prompt-dialog-password-entry',
text: '',
return true;
}
- return (value.length >= 8 && value.length <= 63);
+ return value.length >= 8 && value.length <= 63;
}
_validateStaticWep(secret) {
this._passwordBox = new St.BoxLayout({ vertical: false, style_class: 'prompt-dialog-password-box' });
content.messageBox.add(this._passwordBox);
- this._passwordLabel = new St.Label(({
+ this._passwordLabel = new St.Label({
style_class: 'prompt-dialog-password-label',
y_align: Clutter.ActorAlign.CENTER,
- }));
+ });
this._passwordBox.add_child(this._passwordLabel);
this._passwordEntry = new St.Entry({
style_class: 'prompt-dialog-password-entry',
const Params = imports.misc.params;
const Util = imports.misc.util;
-const HAVE_TP = (Tp != null && Tpl != null);
+const HAVE_TP = Tp != null && Tpl != null;
// See Notification.appendMessage
var SCROLLBACK_IMMEDIATE_TIME = 3 * 60; // 3 minutes
continue;
/* Only observe contact text channels */
- if ((!(channel instanceof Tp.TextChannel)) ||
+ if (!(channel instanceof Tp.TextChannel) ||
targetHandleType != Tp.HandleType.CONTACT)
continue;
bannerMarkup: true });
}
- let group = (message.direction == NotificationDirection.RECEIVED
- ? 'received' : 'sent');
+ let group = message.direction == NotificationDirection.RECEIVED
+ ? 'received' : 'sent';
this._append({ body: messageBody,
group,
return;
let lastMessageTime = this.messages[0].timestamp;
- let currentTime = (Date.now() / 1000);
+ let currentTime = Date.now() / 1000;
// Keep the scrollback from growing too long. If the most
// recent message (before the one we just added) is within
// SCROLLBACK_RECENT_LENGTH previous messages. Otherwise
// we'll keep SCROLLBACK_IDLE_LENGTH messages.
- let maxLength = (lastMessageTime < currentTime - SCROLLBACK_RECENT_TIME)
+ let maxLength = lastMessageTime < currentTime - SCROLLBACK_RECENT_TIME
? SCROLLBACK_IDLE_LENGTH : SCROLLBACK_RECENT_LENGTH;
let filteredHistory = this.messages.filter(item => item.realMessage);
* noTimestamp: suppress timestamp signal?
*/
_append(props) {
- let currentTime = (Date.now() / 1000);
+ let currentTime = Date.now() / 1000;
props = Params.parse(props, { body: null,
group: null,
styles: [],
if (!this._dragPlaceholder)
return DND.DragMotionResult.NO_DROP;
- let srcIsFavorite = (favPos != -1);
+ let srcIsFavorite = favPos != -1;
if (srcIsFavorite)
return DND.DragMotionResult.MOVE_DROP;
let favorites = AppFavorites.getAppFavorites().getFavoriteMap();
- let srcIsFavorite = (id in favorites);
+ let srcIsFavorite = id in favorites;
let favPos = 0;
let children = this._box.get_children();
});
let layout = this._grid.layout_manager;
- let title = (this._locations.length == 0)
+ let title = this._locations.length == 0
? _("Add world clocks…")
: _("World Clocks");
let header = new St.Label({ style_class: 'world-clocks-header',
let otherOffset = this._getTimeAtLocation(l).get_utc_offset();
let offset = (otherOffset - localOffset) / GLib.TIME_SPAN_HOUR;
- let fmt = (Math.trunc(offset) == offset) ? '%s%.0f' : '%s%.1f';
- let prefix = (offset >= 0) ? '+' : '-';
+ let fmt = Math.trunc(offset) == offset ? '%s%.0f' : '%s%.1f';
+ let prefix = offset >= 0 ? '+' : '-';
let tz = new St.Label({ style_class: 'world-clocks-timezone',
text: fmt.format(prefix, Math.abs(offset)),
x_align: Clutter.ActorAlign.END,
this._sources.forEach(source => (count += source.unseenCount));
count -= Main.messageTray.queueCount;
- this.visible = (count > 0);
+ this.visible = count > 0;
}
});
_eventIsRelease(event) {
if (event.type() == Clutter.EventType.BUTTON_RELEASE) {
- let buttonMask = (Clutter.ModifierType.BUTTON1_MASK |
+ let buttonMask = Clutter.ModifierType.BUTTON1_MASK |
Clutter.ModifierType.BUTTON2_MASK |
- Clutter.ModifierType.BUTTON3_MASK);
+ Clutter.ModifierType.BUTTON3_MASK;
/* We only obey the last button release from the device,
* other buttons may get pressed/released during the DnD op.
*/
_cancelDrag(eventTime) {
this.emit('drag-cancelled', eventTime);
- let wasCancelled = (this._dragState == DragState.CANCELLED);
+ let wasCancelled = this._dragState == DragState.CANCELLED;
this._dragState = DragState.CANCELLED;
if (this._actorDestroyed || wasCancelled) {
let [x, y] = this.get_press_coords(0);
let monitorRect = this._getMonitorRect(x, y);
- return ((this._side == St.Side.LEFT && x < monitorRect.x + EDGE_THRESHOLD) ||
+ return (this._side == St.Side.LEFT && x < monitorRect.x + EDGE_THRESHOLD) ||
(this._side == St.Side.RIGHT && x > monitorRect.x + monitorRect.width - EDGE_THRESHOLD) ||
(this._side == St.Side.TOP && y < monitorRect.y + EDGE_THRESHOLD) ||
- (this._side == St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD));
+ (this._side == St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD);
}
vfunc_gesture_progress(_actor) {
// This always returns the same singleton object
// By instantiating it initially, we register the
// bus object, etc.
- (new EndSessionDialog());
+ new EndSessionDialog();
}
var EndSessionDialog = GObject.registerClass(
}
_sync() {
- let open = (this.state == ModalDialog.State.OPENING || this.state == ModalDialog.State.OPENED);
+ let open = this.state == ModalDialog.State.OPENING || this.state == ModalDialog.State.OPENED;
if (!open)
return;
this._timerId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => {
let currentTime = GLib.get_monotonic_time();
- let secondsElapsed = ((currentTime - startTime) / 1000000);
+ let secondsElapsed = (currentTime - startTime) / 1000000;
this._secondsLeft = this._totalSecondsToStayOpen - secondsElapsed;
if (this._secondsLeft > 0) {
let updatesAllowed = this._updatesPermission && this._updatesPermission.allowed;
_setCheckBoxLabel(this._checkBox, dialogContent.checkBoxText || '');
- this._checkBox.visible = (dialogContent.checkBoxText && updatePrepared && updatesAllowed);
- this._checkBox.checked = (updatePrepared && updateTriggered);
+ this._checkBox.visible = dialogContent.checkBoxText && updatePrepared && updatesAllowed;
+ this._checkBox.checked = updatePrepared && updateTriggered;
// We show the warning either together with the checkbox, or when
// updates have already been triggered, but the user doesn't have
// enough permissions to cancel them.
- this._batteryWarning.visible = (dialogContent.showBatteryWarning &&
- (this._checkBox.visible || updatePrepared && updateTriggered && !updatesAllowed));
+ this._batteryWarning.visible = dialogContent.showBatteryWarning &&
+ (this._checkBox.visible || updatePrepared && updateTriggered && !updatesAllowed);
this._updateButtons();
}
_takeModalGrab() {
- let firstGrab = (this._modalCount == 0);
+ let firstGrab = this._modalCount == 0;
if (firstGrab) {
if (!Main.pushModal(this._owner, this._modalParams))
return false;
if (!visible)
continue;
- box._indexLabel.text = ((indexes && indexes[i]) ? indexes[i] : DEFAULT_INDEX_LABELS[i]);
+ box._indexLabel.text = indexes && indexes[i] ? indexes[i] : DEFAULT_INDEX_LABELS[i];
box._candidateLabel.text = candidates[i];
}
let cursorPos = lookupTable.get_cursor_pos();
let pageSize = lookupTable.get_page_size();
let nPages = Math.ceil(nCandidates / pageSize);
- let page = ((cursorPos == 0) ? 0 : Math.floor(cursorPos / pageSize));
+ let page = cursorPos == 0 ? 0 : Math.floor(cursorPos / pageSize);
let startIndex = page * pageSize;
let endIndex = Math.min((page + 1) * pageSize, nCandidates);
}
_updateVisibility() {
- let isVisible = (!Main.keyboard.visible &&
+ let isVisible = !Main.keyboard.visible &&
(this._preeditText.visible ||
this._auxText.visible ||
- this._candidateArea.visible));
+ this._candidateArea.visible);
if (isVisible) {
this.setPosition(this._dummyCursor, 0);
nRows(forWidth) {
let children = this._getVisibleChildren();
- let nColumns = (forWidth < 0) ? children.length : this._computeLayout(forWidth)[0];
- let nRows = (nColumns > 0) ? Math.ceil(children.length / nColumns) : 0;
+ let nColumns = forWidth < 0 ? children.length : this._computeLayout(forWidth)[0];
+ let nRows = nColumns > 0 ? Math.ceil(children.length / nColumns) : 0;
if (this._rowLimit)
nRows = Math.min(nRows, this._rowLimit);
return nRows;
let neededWidth = this.usedWidthForNColumns(this._minColumns) - availWidth;
let neededHeight = this.usedHeightForNRows(this._minRows) - availHeight;
- let neededSpacePerItem = (neededWidth > neededHeight)
+ let neededSpacePerItem = neededWidth > neededHeight
? Math.ceil(neededWidth / this._minColumns)
: Math.ceil(neededHeight / this._minRows);
this._fixedHItemSize = Math.max(this._hItemSize - neededSpacePerItem, MIN_ICON_SIZE);
let childrenPerRow = this._childrenPerPage / this._rowsPerPage;
let sourceRow = Math.floor((index - pageOffset) / childrenPerRow);
- let nRowsAbove = (side == St.Side.TOP) ? sourceRow + 1 : sourceRow;
+ let nRowsAbove = side == St.Side.TOP ? sourceRow + 1 : sourceRow;
let nRowsBelow = this._rowsPerPage - nRowsAbove;
let nRowsUp, nRowsDown;
_onCapturedEvent(actor, event) {
let type = event.type();
- let press = (type == Clutter.EventType.BUTTON_PRESS || type == Clutter.EventType.TOUCH_BEGIN);
- let release = (type == Clutter.EventType.BUTTON_RELEASE || type == Clutter.EventType.TOUCH_END);
+ let press = type == Clutter.EventType.BUTTON_PRESS || type == Clutter.EventType.TOUCH_BEGIN;
+ let release = type == Clutter.EventType.BUTTON_RELEASE || type == Clutter.EventType.TOUCH_END;
if (event.get_source() == this._boxPointer.bin ||
this._boxPointer.bin.contains(event.get_source()))
* basically). We however make things consistent by skipping that
* second level.
*/
- let level = (i >= 1 && levels.length == 3) ? i + 1 : i;
+ let level = i >= 1 && levels.length == 3 ? i + 1 : i;
let layout = new KeyContainer();
layout.shiftKeys = [];
if (switchToLevel != null) {
this._setActiveLayer(switchToLevel);
// Shift only gets latched on long press
- this._latched = (switchToLevel != 1);
+ this._latched = switchToLevel != 1;
} else if (keyval != null) {
this._keyboardController.keyvalPress(keyval);
}
else if (state == Clutter.InputPanelState.ON)
enabled = true;
else if (state == Clutter.InputPanelState.TOGGLE)
- enabled = (this._keyboardVisible == false);
+ enabled = this._keyboardVisible == false;
else
return;
_init() {
super._init();
- this._rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
+ this._rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
this.monitors = [];
this.primaryMonitor = null;
this.primaryIndex = -1;
});
// Export to dbus.
- (new MagnifierDBus.ShellMagnifier());
+ new MagnifierDBus.ShellMagnifier();
this.setActive(St.Settings.get().magnifier_active);
}
getCrosshairsClip() {
if (this._crossHairs) {
let [clipWidth, clipHeight] = this._crossHairs.getClip();
- return (clipWidth > 0 && clipHeight > 0);
+ return clipWidth > 0 && clipHeight > 0;
} else {
return false;
}
let xMouse = this._magnifier.xMouse;
let yMouse = this._magnifier.yMouse;
- mouseIsOver = (
+ mouseIsOver =
xMouse >= this._viewPortX && xMouse < (this._viewPortX + this._viewPortWidth) &&
- yMouse >= this._viewPortY && yMouse < (this._viewPortY + this._viewPortHeight)
- );
+ yMouse >= this._viewPortY && yMouse < (this._viewPortY + this._viewPortHeight);
}
return mouseIsOver;
}
let yRoiBottom = yRoi + heightRoi - cursorHeight;
if (xPoint < xRoi)
- xPos -= (xRoi - xPoint);
+ xPos -= xRoi - xPoint;
else if (xPoint > xRoiRight)
- xPos += (xPoint - xRoiRight);
+ xPos += xPoint - xRoiRight;
if (yPoint < yRoi)
- yPos -= (yRoi - yPoint);
+ yPos -= yRoi - yPoint;
else if (yPoint > yRoiBottom)
- yPos += (yPoint - yRoiBottom);
+ yPos += yPoint - yRoiBottom;
return [xPos, yPos];
}
// it modifies the brightness and/or contrast.
let [cRed, cGreen, cBlue] = this._brightnessContrast.get_contrast();
this._brightnessContrast.set_enabled(
- (bRed != NO_CHANGE || bGreen != NO_CHANGE || bBlue != NO_CHANGE ||
- cRed != NO_CHANGE || cGreen != NO_CHANGE || cBlue != NO_CHANGE)
+ bRed != NO_CHANGE || bGreen != NO_CHANGE || bBlue != NO_CHANGE ||
+ cRed != NO_CHANGE || cGreen != NO_CHANGE || cBlue != NO_CHANGE
);
}
layoutManager.init();
overview.init();
- (new PointerA11yTimeout.PointerA11yTimeout());
+ new PointerA11yTimeout.PointerA11yTimeout();
_a11ySettings = new Gio.Settings({ schema_id: A11Y_SCHEMA });
function activateWindow(window, time, workspaceNum) {
let workspaceManager = global.workspace_manager;
let activeWorkspaceNum = workspaceManager.get_active_workspace_index();
- let windowWorkspaceNum = (workspaceNum !== undefined) ? workspaceNum : window.get_workspace().index();
+ let windowWorkspaceNum = workspaceNum !== undefined ? workspaceNum : window.get_workspace().index();
if (!time)
time = global.get_current_time();
*/
function initializeDeferredWork(actor, callback) {
// Turn into a string so we can use as an object property
- let workId = `${(++_deferredWorkSequence)}`;
+ let workId = `${++_deferredWorkSequence}`;
_deferredWorkData[workId] = { actor,
callback };
actor.connect('notify::mapped', () => {
let visibleIndex = this._expansion > 0 ? 1 : 0;
for (let i = 0; this._container && i < this._container.get_n_children(); i++)
- this._container.get_child_at_index(i).visible = (i == visibleIndex);
+ this._container.get_child_at_index(i).visible = i == visibleIndex;
this.layout_changed();
}
setIcon(actor) {
this._iconBin.child = actor;
- this._iconBin.visible = (actor != null);
+ this._iconBin.visible = actor != null;
}
setSecondaryActor(actor) {
expand(animate) {
this.expanded = true;
- this._actionBin.visible = (this._actionBin.get_n_children() > 0);
+ this._actionBin.visible = this._actionBin.get_n_children() > 0;
if (this._bodyStack.get_n_children() < 2) {
this._expandedLabel = new URLHighlighter(this._bodyText,
// indicator in the panel; however do make an exception for CRITICAL
// notifications, as only banner mode allows expansion.
let bannerCount = this._notification ? 1 : 0;
- let full = (this.queueCount + bannerCount >= MAX_NOTIFICATIONS_IN_QUEUE);
+ let full = this.queueCount + bannerCount >= MAX_NOTIFICATIONS_IN_QUEUE;
if (!full || notification.urgency == Urgency.CRITICAL) {
notification.connect('destroy',
this._onNotificationDestroy.bind(this));
let nextNotification = this._notificationQueue[0] || null;
if (hasNotifications && nextNotification) {
let limited = this._busy || Main.layoutManager.primaryMonitor.inFullscreen;
- let showNextNotification = (!limited || nextNotification.forFeedback || nextNotification.urgency == Urgency.CRITICAL);
+ let showNextNotification = !limited || nextNotification.forFeedback || nextNotification.urgency == Urgency.CRITICAL;
if (showNextNotification)
this._showNotification();
}
this._notification.urgency != Urgency.CRITICAL &&
!this._banner.focused &&
!this._pointerInNotification) || this._notificationExpired;
- let mustClose = (this._notificationRemoved || !hasNotifications || expired);
+ let mustClose = this._notificationRemoved || !hasNotifications || expired;
if (mustClose) {
let animate = hasNotifications && !this._notificationRemoved;
// of the 'transient' hint with hints['transient'] rather than hints.transient
notification.setTransient(!!hints['transient']);
- let privacyScope = (hints['x-gnome-privacy-scope'] || 'user');
+ let privacyScope = hints['x-gnome-privacy-scope'] || 'user';
notification.setPrivacyScope(privacyScope == 'system'
? MessageTray.PrivacyScope.SYSTEM
: MessageTray.PrivacyScope.USER);
_trackClient(client) {
if (this._client)
- return (this._client == client);
+ return this._client == client;
this._client = client;
this._clientWatchId = Gio.bus_watch_name(Gio.BusType.SESSION, client, 0, null,
}
setLabel(label) {
- this._label.visible = (label != undefined);
+ this._label.visible = label != undefined;
if (label)
this._label.text = label;
}
setLevel(value) {
- this._level.visible = (value != undefined);
+ this._level.visible = value != undefined;
if (value != undefined) {
if (this.visible) {
this._level.ease_property('value', value, {
let event = Clutter.get_current_event();
if (event) {
let type = event.type();
- let button = (type == Clutter.EventType.BUTTON_PRESS ||
- type == Clutter.EventType.BUTTON_RELEASE);
+ let button = type == Clutter.EventType.BUTTON_PRESS ||
+ type == Clutter.EventType.BUTTON_RELEASE;
let ctrl = (event.get_state() & Clutter.ModifierType.CONTROL_MASK) != 0;
if (button && ctrl)
return;
var SIDE_CONTROLS_ANIMATION_TIME = 160;
function getRtlSlideDirection(direction, actor) {
- let rtl = (actor.text_direction == Clutter.TextDirection.RTL);
+ let rtl = actor.text_direction == Clutter.TextDirection.RTL;
if (rtl) {
- direction = (direction == SlideDirection.LEFT)
+ direction = direction == SlideDirection.LEFT
? SlideDirection.RIGHT : SlideDirection.LEFT;
}
return direction;
// flags only determine what to do if the allocated box is bigger
// than the actor's box.
let realDirection = getRtlSlideDirection(this._direction, child);
- let alignX = (realDirection == SlideDirection.LEFT)
+ let alignX = realDirection == SlideDirection.LEFT
? availWidth - natWidth
: availWidth - natWidth * this._slideX;
let translationEnd = 0;
let translation = this._getTranslation();
- let shouldShow = (this._getSlide() > 0);
+ let shouldShow = this._getSlide() > 0;
if (shouldShow)
translationStart = translation;
else
return;
let activePage = this.viewSelector.getActivePage();
- let dashVisible = (activePage == ViewSelector.ViewPage.WINDOWS ||
- activePage == ViewSelector.ViewPage.APPS);
- let thumbnailsVisible = (activePage == ViewSelector.ViewPage.WINDOWS);
+ let dashVisible = activePage == ViewSelector.ViewPage.WINDOWS ||
+ activePage == ViewSelector.ViewPage.APPS;
+ let thumbnailsVisible = activePage == ViewSelector.ViewPage.WINDOWS;
if (dashVisible)
this._dashSlider.slideIn();
return;
let activePage = this.viewSelector.getActivePage();
- this._dashSpacer.visible = (activePage == ViewSelector.ViewPage.WINDOWS);
+ this._dashSpacer.visible = activePage == ViewSelector.ViewPage.WINDOWS;
}
_onPageEmpty() {
this._actionComboBox.setAction(this._currentAction);
this._updateKeybindingEntryState();
- let isButton = (action == Meta.PadActionType.BUTTON);
+ let isButton = action == Meta.PadActionType.BUTTON;
this._actionComboBox.setButtonActionsActive(isButton);
}
}
_wrappingSvgHeader() {
- return ('<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +
- '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" ' +
- 'xmlns:xi="http://www.w3.org/2001/XInclude" ' +
- `width="${ // " (give xgettext the paired quotes it expects)
- this._imageWidth
- }" height="${this._imageHeight}"> ` + // "
- '<style type="text/css">');
+ return '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +
+ '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" ' +
+ 'xmlns:xi="http://www.w3.org/2001/XInclude" ' +
+ `width="${ // " (give xgettext the paired quotes it expects)
+ this._imageWidth
+ }" height="${this._imageHeight}"> ` + // "
+ '<style type="text/css">';
}
_wrappingSvgFooter() {
- return ('</style>' +
+ return '</style>' +
'<xi:include href="' + this._imagePath + '" />' +
- '</svg>');
+ '</svg>';
}
_cssString() {
if (!this._editedAction)
return false;
- return (this._editedAction.type == type &&
+ return this._editedAction.type == type &&
this._editedAction.number == number &&
- this._editedAction.dir == dir);
+ this._editedAction.dir == dir;
}
_followUpActionEdition(str) {
let { type, dir, number, mode } = this._editedAction;
- let hasNextAction = (type == Meta.PadActionType.RING && dir == CCW ||
- type == Meta.PadActionType.STRIP && dir == UP);
+ let hasNextAction = type == Meta.PadActionType.RING && dir == CCW ||
+ type == Meta.PadActionType.STRIP && dir == UP;
if (!hasNextAction)
return false;
children[i].destroy();
}
this._nPages = nPages;
- this.visible = (this._nPages > 1);
+ this.visible = this._nPages > 1;
}
setCurrentPage(currentPage) {
_updateDetailsVisibility() {
let sw = this._appSystem.lookup_app('org.gnome.Software.desktop');
- this._detailsItem.visible = (sw != null);
+ this._detailsItem.visible = sw != null;
}
isEmpty() {
}
}
- let visible = (this._targetApp != null && !Main.overview.visibleTarget);
+ let visible = this._targetApp != null && !Main.overview.visibleTarget;
if (visible)
this.fadeIn();
else
this.fadeOut();
- let isBusy = (this._targetApp != null &&
+ let isBusy = this._targetApp != null &&
(this._targetApp.get_state() == Shell.AppState.STARTING ||
- this._targetApp.get_busy()));
+ this._targetApp.get_busy());
if (isBusy)
this.startAnimation();
else
this.stopAnimation();
- this.reactive = (visible && !isBusy);
+ this.reactive = visible && !isBusy;
this._syncIcon();
this.menu.setApp(this._targetApp);
if (index < 0)
return null;
- if (!(children[index].has_style_class_name('panel-menu')) &&
- !(children[index].has_style_class_name('panel-button')))
+ if (!children[index].has_style_class_name('panel-menu') &&
+ !children[index].has_style_class_name('panel-button'))
return this._findRightmostButton(children[index]);
return children[index];
if (index == children.length)
return null;
- if (!(children[index].has_style_class_name('panel-menu')) &&
- !(children[index].has_style_class_name('panel-button')))
+ if (!children[index].has_style_class_name('panel-menu') &&
+ !children[index].has_style_class_name('panel-button'))
return this._findLeftmostButton(children[index]);
return children[index];
if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) {
let group = global.focus_manager.get_group(this);
if (group) {
- let direction = (symbol == Clutter.KEY_Left) ? St.DirectionType.LEFT : St.DirectionType.RIGHT;
+ let direction = symbol == Clutter.KEY_Left ? St.DirectionType.LEFT : St.DirectionType.RIGHT;
group.navigate_focus(this, direction, false);
return Clutter.EVENT_STOP;
}
// measures are in logical pixels, so make sure to consider the scale
// factor when computing max-height
let maxHeight = Math.round((workArea.height - verticalMargins) / scaleFactor);
- this.menu.actor.style = ('max-height: %spx;').format(maxHeight);
+ this.menu.actor.style = 'max-height: %spx;'.format(maxHeight);
}
_onDestroy() {
return -1;
// finally, if both providers are found, return their order in the list
- return (idxA - idxB);
+ return idxA - idxB;
});
callback(loadedProviders);
if (this._lockScreenState != MessageTray.State.SHOWN)
return Clutter.EVENT_PROPAGATE;
- let isEnter = (symbol == Clutter.KEY_Return ||
+ let isEnter = symbol == Clutter.KEY_Return ||
symbol == Clutter.KEY_KP_Enter ||
- symbol == Clutter.KEY_ISO_Enter);
- let isEscape = (symbol == Clutter.KEY_Escape);
- let isLiftChar = (GLib.unichar_isprint(unichar) &&
- (this._isLocked || !GLib.unichar_isgraph(unichar)));
+ symbol == Clutter.KEY_ISO_Enter;
+ let isEscape = symbol == Clutter.KEY_Escape;
+ let isLiftChar = GLib.unichar_isprint(unichar) &&
+ (this._isLocked || !GLib.unichar_isgraph(unichar));
if (!isEnter && !isEscape && !isLiftChar)
return Clutter.EVENT_PROPAGATE;
_syncInhibitor() {
let lockEnabled = this._settings.get_boolean(LOCK_ENABLED_KEY);
let lockLocked = this._lockSettings.get_boolean(DISABLE_LOCK_KEY);
- let inhibit = (this._loginSession && this._loginSession.Active &&
- !this._isActive && lockEnabled && !lockLocked);
+ let inhibit = this._loginSession && this._loginSession.Active &&
+ !this._isActive && lockEnabled && !lockLocked;
if (inhibit) {
this._loginManager.inhibit(_("GNOME needs to lock the screen"),
inhibitor => {
// restore the lock screen to its original place
// try to use the same speed as the normal animation
let h = global.stage.height;
- let duration = MANUAL_FADE_TIME * (-this._lockScreenGroup.y) / h;
+ let duration = MANUAL_FADE_TIME * -this._lockScreenGroup.y / h;
this._lockScreenGroup.remove_all_transitions();
this._lockScreenGroup.ease({
y: 0,
// use the same speed regardless of original position
// if velocity is specified, it's in pixels per milliseconds
let h = global.stage.height;
- let delta = (h + this._lockScreenGroup.y);
+ let delta = h + this._lockScreenGroup.y;
let minVelocity = global.stage.height / CURTAIN_SLIDE_TIME;
velocity = Math.max(minVelocity, velocity);
_updateSearchProgress() {
let haveResults = this._providers.some(provider => {
let display = provider.display;
- return (display.getFirstResult() != null);
+ return display.getFirstResult() != null;
});
this._scrollView.visible = haveResults;
var SessionMode = class {
constructor() {
_loadModes();
- let isPrimary = (_modes[global.session_mode] &&
- _modes[global.session_mode].isPrimary);
+ let isPrimary = _modes[global.session_mode] &&
+ _modes[global.session_mode].isPrimary;
let mode = isPrimary ? global.session_mode : 'user';
this._modeStack = [mode];
this._sync();
}
_updatePasswordItem() {
- let textHidden = (this._entry.clutter_text.password_char);
+ let textHidden = this._entry.clutter_text.password_char;
if (textHidden)
this._passwordItem.label.set_text(_("Show Text"));
else
}
_onPasswordActivated() {
- let visible = !!(this._entry.clutter_text.password_char);
+ let visible = !!this._entry.clutter_text.password_char;
this._entry.clutter_text.set_password_char(visible ? '' : '\u25cf');
}
};
let interfaceSettings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
let gtkTheme = interfaceSettings.get_string(KEY_GTK_THEME);
let iconTheme = interfaceSettings.get_string(KEY_ICON_THEME);
- let hasHC = (gtkTheme == HIGH_CONTRAST_THEME);
+ let hasHC = gtkTheme == HIGH_CONTRAST_THEME;
let highContrast = this._buildItemExtended(
_("High Contrast"),
hasHC,
_buildFontItem() {
let settings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
- let initialSetting = (factor > 1.0);
+ let initialSetting = factor > 1.0;
let widget = this._buildItemExtended(_("Large Text"),
initialSetting,
settings.is_writable(KEY_TEXT_SCALING_FACTOR),
settings.connect(`changed::${KEY_TEXT_SCALING_FACTOR}`, () => {
factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
- let active = (factor > 1.0);
+ let active = factor > 1.0;
widget.setToggleState(active);
this._queueSyncMenuVisibility();
_syncMenuVisibility() {
this.visible =
- (this._a11ySettings.get_boolean(KEY_DWELL_CLICK_ENABLED) &&
- this._a11ySettings.get_string(KEY_DWELL_MODE) == DWELL_MODE_WINDOW);
+ this._a11ySettings.get_boolean(KEY_DWELL_CLICK_ENABLED) &&
+ this._a11ySettings.get_string(KEY_DWELL_MODE) == DWELL_MODE_WINDOW;
return GLib.SOURCE_REMOVE;
}
this._getMaxAccuracyLevel());
authorizer.authorize(accuracyLevel => {
- let ret = (accuracyLevel != GeoclueAccuracyLevel.NONE);
+ let ret = accuracyLevel != GeoclueAccuracyLevel.NONE;
invocation.return_value(GLib.Variant.new('(bu)',
[ret, accuracyLevel]));
});
_sync() {
let nItems = this._connectionItems.size;
- this._radioSection.actor.visible = (nItems > 1);
- this._labelSection.actor.visible = (nItems == 1);
+ this._radioSection.actor.visible = nItems > 1;
+ this._labelSection.actor.visible = nItems == 1;
this.item.label.text = this._getStatus();
this.item.icon.icon_name = this._getMenuIcon();
_sync() {
let nItems = this._connectionItems.size;
- this._autoConnectItem.visible = (nItems == 0);
+ this._autoConnectItem.visible = nItems == 0;
this._deactivateItem.visible = this._device.state > NM.DeviceState.DISCONNECTED;
if (this._activeConnection == null) {
} else {
this._airplaneBox.hide();
- this._noNetworksBox.visible = (this._networks.length == 0);
+ this._noNetworksBox.visible = this._networks.length == 0;
}
if (this._noNetworksBox.visible)
_sync() {
let nItems = this._connectionItems.size;
- this.item.visible = (nItems > 0);
+ this.item.visible = nItems > 0;
super._sync();
}
_syncVpnConnections() {
let activeConnections = this._client.get_active_connections() || [];
let vpnConnections = activeConnections.filter(
- a => (a instanceof NM.VpnConnection)
+ a => a instanceof NM.VpnConnection
);
vpnConnections.forEach(a => {
ensureActiveConnectionProps(a);
}
this._vpnIndicator.icon_name = this._vpnSection.getIndicatorIcon();
- this._vpnIndicator.visible = (this._vpnIndicator.icon_name != '');
+ this._vpnIndicator.visible = this._vpnIndicator.icon_name != '';
}
});
let hwAirplaneMode = this._manager.hwAirplaneMode;
let showAirplaneMode = this._manager.shouldShowAirplaneMode;
- this._indicator.visible = (airplaneMode && showAirplaneMode);
- this._item.visible = (airplaneMode && showAirplaneMode);
+ this._indicator.visible = airplaneMode && showAirplaneMode;
+ this._item.visible = airplaneMode && showAirplaneMode;
this._offItem.setSensitive(!hwAirplaneMode);
if (hwAirplaneMode)
_updateVolume() {
let muted = this._stream.is_muted;
this._changeSlider(muted
- ? 0 : (this._stream.volume / this._control.get_vol_max_norm()));
+ ? 0 : this._stream.volume / this._control.get_vol_max_norm());
this.emit('stream-updated');
}
}
_updateSliderIcon() {
- this._icon.icon_name = (this._hasHeadphones
+ this._icon.icon_name = this._hasHeadphones
? 'audio-headphones-symbolic'
- : 'audio-speakers-symbolic');
+ : 'audio-speakers-symbolic';
}
_portChanged() {
childBox.x2 = childBox.x1 + arrowWidth;
childBox.y2 = childBox.y1 + arrowHeight;
this._leftArrow.allocate(childBox, flags);
- this._leftArrow.opacity = (this._scrollableLeft && scrollable) ? 255 : 0;
+ this._leftArrow.opacity = this._scrollableLeft && scrollable ? 255 : 0;
arrowWidth = Math.floor(rightPadding / 3);
arrowHeight = arrowWidth * 2;
childBox.x2 = childBox.x1 + arrowWidth;
childBox.y2 = childBox.y1 + arrowHeight;
this._rightArrow.allocate(childBox, flags);
- this._rightArrow.opacity = (this._scrollableRight && scrollable) ? 255 : 0;
+ this._rightArrow.opacity = this._scrollableRight && scrollable ? 255 : 0;
}
});
_onStageKeyFocusChanged() {
let focus = global.stage.get_key_focus();
- let appearFocused = (this._entry.contains(focus) ||
- this._searchResults.contains(focus));
+ let appearFocused = this._entry.contains(focus) ||
+ this._searchResults.contains(focus);
this._text.set_cursor_visible(appearFocused);
_onTextChanged() {
let terms = getTermsForSearchString(this._entry.get_text());
- this._searchActive = (terms.length > 0);
+ this._searchActive = terms.length > 0;
this._searchResults.setTerms(terms);
if (this._searchActive) {
if (this._rect && this._rect.equal(tileRect))
return;
- let changeMonitor = (this._monitorIndex == -1 ||
- this._monitorIndex != monitorIndex);
+ let changeMonitor = this._monitorIndex == -1 ||
+ this._monitorIndex != monitorIndex;
this._monitorIndex = monitorIndex;
this._rect = tileRect;
// Scale deltas up a bit to make it feel snappier
this._dx += dx * 2;
- if (!(this._touchpadSettings.get_boolean('natural-scroll')))
+ if (!this._touchpadSettings.get_boolean('natural-scroll'))
this._dy -= dy * 2;
else
this._dy += dy * 2;
if (!super.vfunc_gesture_prepare(actor))
return false;
- return (this._allowedModes & Main.actionMode);
+ return this._allowedModes & Main.actionMode;
}
vfunc_gesture_progress(_actor) {
let win = actor.metaWindow;
let workspaceManager = global.workspace_manager;
let activeWorkspace = workspaceManager.get_active_workspace();
- return (!win.is_override_redirect() &&
- win.located_on_workspace(activeWorkspace));
+ return !win.is_override_redirect() &&
+ win.located_on_workspace(activeWorkspace);
});
if (windows.length == 0)
vfunc_key_press_event(keyEvent) {
let symbol = keyEvent.keyval;
- let isEnter = (symbol == Clutter.KEY_Return || symbol == Clutter.KEY_KP_Enter);
+ let isEnter = symbol == Clutter.KEY_Return || symbol == Clutter.KEY_KP_Enter;
if (isEnter) {
this._activate();
return true;
if (!one || !two)
return false;
- return (one.x == two.x &&
+ return one.x == two.x &&
one.y == two.y &&
one.width == two.width &&
- one.height == two.height);
+ one.height == two.height;
}
/**
_delayedWindowRepositioning() {
let [x, y] = global.get_pointer();
- let pointerHasMoved = (this._cursorX != x && this._cursorY != y);
- let inWorkspace = (this._fullGeometry.x < x && x < this._fullGeometry.x + this._fullGeometry.width &&
- this._fullGeometry.y < y && y < this._fullGeometry.y + this._fullGeometry.height);
+ let pointerHasMoved = this._cursorX != x && this._cursorY != y;
+ let inWorkspace = this._fullGeometry.x < x && x < this._fullGeometry.x + this._fullGeometry.width &&
+ this._fullGeometry.y < y && y < this._fullGeometry.y + this._fullGeometry.height;
if (pointerHasMoved && inWorkspace) {
// store current cursor position
let [, h] = this._thumbnails[i].get_transformed_size();
let targetBottom = targetBase + WORKSPACE_CUT_SIZE;
let nextTargetBase = targetBase + h + spacing;
- let nextTargetTop = nextTargetBase - spacing - ((i == length - 1) ? 0 : WORKSPACE_CUT_SIZE);
+ let nextTargetTop = nextTargetBase - spacing - (i == length - 1 ? 0 : WORKSPACE_CUT_SIZE);
// Expand the target to include the placeholder, if it exists.
if (i == this._dropPlaceholderPos)
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
- let rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
+ let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
if (this._thumbnails.length == 0) // not visible
return;
childBox.x1 -= indicatorLeftFullBorder;
childBox.x2 += indicatorRightFullBorder;
childBox.y1 = indicatorY1 - indicatorTopFullBorder;
- childBox.y2 = (indicatorY2 ? indicatorY2 : (indicatorY1 + thumbnailHeight)) + indicatorBottomFullBorder;
+ childBox.y2 = (indicatorY2 ? indicatorY2 : indicatorY1 + thumbnailHeight) + indicatorBottomFullBorder;
this._indicator.allocate(childBox, flags);
}
if (this._animating || this._scrolling || this._gestureActive)
workspace.show();
else if (this._inDrag)
- workspace.visible = (Math.abs(w - active) <= 1);
+ workspace.visible = Math.abs(w - active) <= 1;
else
- workspace.visible = (w == active);
+ workspace.visible = w == active;
}
}
let monitors = Main.layoutManager.monitors;
for (let i = 0; i < monitors.length; i++) {
- let geometry = (i == this._primaryIndex) ? this._fullGeometry : monitors[i];
+ let geometry = i == this._primaryIndex ? this._fullGeometry : monitors[i];
this._workspacesViews[i].setFullGeometry(geometry);
}
}
let monitors = Main.layoutManager.monitors;
for (let i = 0; i < monitors.length; i++) {
- let geometry = (i == this._primaryIndex) ? primaryGeometry : monitors[i];
+ let geometry = i == this._primaryIndex ? primaryGeometry : monitors[i];
this._workspacesViews[i].setActualGeometry(geometry);
}
}